Skip to main content

安装iTem2 + oh-my-zsh

安装iTem2

安装

安装iTem2

设置成默认终端软件

依次点击iTerm2>Make ITerm2 Default Term菜单,将iTem2设置成默认终端软件。

配置样式

  1. 依次点击iTerm2>Settings...菜单,在打开的Preferences窗口中,选择Profiles选项卡。
  2. 选中名称为Default的Profile,然后依次点击左下角的Other Actions...>Import JSON Profiles...菜单,将limpeak-item2.json文件导入到Profile列表中。
  3. 选中名称为limpeak-item2的Profile,然后依次点击左下角的Other Actions...>Set as Default菜单。

安装oh-my-zsh

安装

安装oh-my-zsh

配置环境变量

如果~/.zshrc.pre-oh-my-zsh文件存在,则将~/.zshrc.pre-oh-my-zsh文件的内容复制到~/.zshrc文件中,然后删除~/.zshrc.pre-oh-my-zsh文件。

配置插件

  1. 安装扩展插件zsh-autosuggestionszsh-syntax-highlighting
    # 安装自动提示命令插件zsh-autosuggestions
    git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/plugins/zsh-autosuggestions
    # 安装语法高亮插件zsh-syntax-highlighting
    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting
  2. 修改~/.zshrc文件中plugins属性的值,启用自带插件last-working-dir、扩展插件zsh-autosuggestions和扩展插件zsh-syntax-highlighting
      # Which plugins would you like to load?
    # Standard plugins can be found in $ZSH/plugins/
    # Custom plugins may be added to $ZSH_CUSTOM/plugins/
    # Example format: plugins=(rails git textmate ruby lighthouse)
    # Add wisely, as too many plugins slow down shell startup.
    - plugins=(git)
    + plugins=(git last-working-dir zsh-autosuggestions zsh-syntax-highlighting)

配置主题

  1. ~/.oh-my-zsh/themes目录中创建主题文件limpeak-oh-my-zsh.zsh-theme,文件内容如下:
    PROMPT="%{$fg_bold[cyan]%}%c"
    PROMPT+=' %(?:%{$fg_bold[green]%}$ :%{$fg_bold[red]%}$ )%{$reset_color%}$(git_prompt_info)'

    ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
    ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
    ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
    ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
  2. 修改~/.zshrc文件中ZSH_THEME属性的值,启用自定义主题:
      # Set name of the theme to load --- if set to "random", it will
    # load a random theme each time oh-my-zsh is loaded, in which case,
    # to know which specific one was loaded, run: echo $RANDOM_THEME
    # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
    - ZSH_THEME="robbyrussell"
    + ZSH_THEME="limpeak-oh-my-zsh"